#include "public_define.h"

//add by gd
//车辆vin码
std::string global_data::g_car_vin ="";
//车tuid
std::string global_data::g_car_tuid = "";
//状态机运行状态
uint32_t global_data::g_adc_status = ADC_STATUS_DIAG;
//状态机运行状态
uint32_t global_data::g_work_status = 0;
//车定位
uint32_t global_data::g_car_location_lng = 0;
//车定位
uint32_t global_data::g_car_location_lat = 0;
//采集配置
std::string global_data::g_collect_config_buf;
//采集fenceType类型
std::string global_data::g_normal_collect__fenceType;
//采集通用地图标签文件名
std::vector<std::string> global_data::g_normal_collect__filename;
//采集所有topic
std::vector<std::string> global_data::g_topics;
//泊车采集所有topic
std::vector<std::string> global_data::g_parking_topics;
//非车采集所有topic
std::vector<std::string> global_data::g_no_parking_topics;

//采集所有中间变量topic
std::vector<std::string> global_data::g_topics_mid;
//采集所有视频topic
std::vector<std::string> global_data::g_topics_vedio;
//采集所有图片topic
std::vector<std::string> global_data::g_topics_pic;
//采集RPC topic
std::vector<std::string> global_data::g_topics_rpc;
//topic与编码号映射
map<int, std::string> global_data::g_topics_map;
//cam0~6视觉标定文件名与文件内容映射
map<std::string,std::string> global_data::g_fc_calib;
//环视标定文件名与文件内容映射
map<std::string,std::string> global_data::g_sc_calib;
//雷达标定文件名与文件内容映射
map<std::string,std::string> global_data::g_ldr_calib;

// http证书位置
std::string global_data::g_http_ca_path = "/image_conf/changan/ca/";
// tuid路径
std::string global_data::g_tuid_path = "/image_conf/changan/ca/TUID.txt";
//证书私钥cert
std::string global_data::g_client_cert = "client.cer";
//证书私钥key
std::string global_data::g_client_key = "private.key";
//证书私钥key 存文件流
std::string global_data::g_client_keyBuff;
//c2大版本
std::string global_data::g_C2_bigVersion;
//c3b线程
std::vector<std::thread> global_data::g_c3bThread;

// 接口版本
// std::string global_data::g_cloudConfigVersion = "INITIALIZE";
std::string global_data::g_cloudConfigVersion = "202310271200554";
// 迭代版本
std::string global_data::g_iteration = "R20"; //发版就得更新迭代版本号  if44感知接口变化大，用R15编号
bool global_data::g_isUploadDesensFile = false;
int global_data::g_debugFlag = 0;

//采集黑名单 (这里面的不采集，后续从云端拉取)
std::set<string> global_data::blackTopicSet = {
    "test"
};

//不限制大小的topic;(超过500k依然会采集)
std::set<string> global_data::noLimitBigSet = {
    ENCODE_SRV_H265_CAM0,
    ENCODE_SRV_H265_CAM1,
    ENCODE_SRV_H265_CAM2,
    ENCODE_SRV_H265_CAM3,
    ENCODE_SRV_H265_CAM4,
    ENCODE_SRV_H265_CAM5,
    ENCODE_SRV_H265_CAM6,
    ENCODE_SRV_H265_CAM7,
    ENCODE_SRV_H265_CAM8,
    ENCODE_SRV_H265_CAM9,
    ENCODE_SRV_H265_CAM10,
    ENCODE_SRV_DESENS_H265_CAM0,
    ENCODE_SRV_DESENS_H265_CAM1,
    ENCODE_SRV_DESENS_H265_CAM2,
    ENCODE_SRV_DESENS_H265_CAM3,
    ENCODE_SRV_DESENS_H265_CAM4,
    ENCODE_SRV_DESENS_H265_CAM5,
    ENCODE_SRV_DESENS_H265_CAM6,
    ENCODE_SRV_DESENS_H265_CAM7,
    ENCODE_SRV_DESENS_H265_CAM8,
    ENCODE_SRV_DESENS_H265_CAM9,
    ENCODE_SRV_DESENS_H265_CAM10,
    "encode_srv-EncodeSrv.EncodeJpeg-CAM0",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM1",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM2",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM3",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM4",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM5",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM6",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM7",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM8",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM9",
    "encode_srv-EncodeSrv.EncodeJpeg-CAM10",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM0",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM1",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM2",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM3",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM4",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM5",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM6",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM7",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM8",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM9",
    "encode_srv-EncodeSrv.EncodeJpeg-DesensCAM10",
    "sab-string-left_raw",
    //"sab-string-right_raw",
    "sab-string-top_raw",
    "ad_algo_map-idmap.IDMapDiagnosis",
    "ad_algo_map-sdmap.RequestInfo-Record",
    // "sab-DasUssProto.RawData",//太大了
    "ad_algo_map-idmap.StaticIDMapInfo"
};


//云端配置是否拉取成功的标志
bool global_data::is_use_config_cloud=true;

// 文件分片的大小
uint64_t global_data::g_file_chunk_size = 100 * 1024 * 1024; // 100M;
// 每个分片最大值
uint32_t global_data::g_per_chunk_size = 20 * 1024 * 1024; //20M

// 预生产/生产环境前缀
std::string global_data::g_cloudNetPrefix = STR_DEVEVN;

ExtEventInfo global_data::g_extEvent;

AdrInterface::AdrDiagnosis global_data::g_adrDiagnosisSts;
void ModifyDiagnosisSts(uint32_t setBit, string diagnosis_info)
{
    uint32_t mdBit = global_data::g_adrDiagnosisSts.diagnosis_code() | setBit;   
    global_data::g_adrDiagnosisSts.set_diagnosis_code(mdBit);
    if (!diagnosis_info.empty())
    {
        string diagStr = global_data::g_adrDiagnosisSts.diagnosis_info() + diagnosis_info;
        global_data::g_adrDiagnosisSts.set_diagnosis_info(diagStr);
    }
}
